package com.ys.erp.stage_mall_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.stage_mall_service.bean.condition.KingKongConfigCondition;
import com.ys.erp.stage_mall_service.bean.vo.KingKongConfigInfoVO;
import com.ys.erp.stage_mall_service.bean.vo.KingKongConfigVO;
import com.ys.erp.stage_mall_service.service.KingKongConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author minamiyama
 * @date 2025/5/16 10:47
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("manage/mall/kingKong/")
@Tag(name = "商城金刚区配置", description = "商城金刚区配置")
@ResponseResult
public class KingKongConfigController {
    private final KingKongConfigService kingKongConfigService;


    /**
     * 添加King Kong配置信息
     */
    @Operation(summary = "新增或者修改金刚区配置信息")
    @PostMapping("addOrUpdateKingKongConfig")
    @CheckEmpLogin
    public void addOrUpdateKingKongConfig(@RequestBody KingKongConfigCondition.AddOrUpdateKingKongConfigCon con, @StageLoginEmp StageEmpDTO empDTO) {
        kingKongConfigService.addKingKongConfig(con, empDTO);
    }

    /**
     * 查询King Kong配置信息
     */

    @Operation(summary = "查询金刚区配置信息")
    @GetMapping("getKingKongConfig")
    @CheckEmpLogin
    public List<KingKongConfigVO> getKingKongConfig(@StageLoginEmp StageEmpDTO empDTO) {
        return kingKongConfigService.getKingKongConfig();
    }

    /**
     * 更新金刚区配置状态
     */
    @Operation(summary = "更新金刚区配置状态")
    @GetMapping("updateKingKongConfigStatus")
    @CheckEmpLogin
    public void updateKingKongConfigStatus(@RequestParam Long id,@StageLoginEmp StageEmpDTO empDTO) {
        kingKongConfigService.updateKingKongConfigStatus(id);
    }

    @Operation(summary = "删除金刚区配置")
    @GetMapping("deleteKingKongConfig")
    @CheckEmpLogin
    public void deleteKingKongConfig(@RequestParam Long id,@StageLoginEmp StageEmpDTO empDTO) {
        kingKongConfigService.deleteKingKongConfig(id);
    }

    @Operation(summary = "获取金刚区配置根据id")
    @GetMapping("getKingKongConfigInfo")
    @CheckEmpLogin
    public KingKongConfigInfoVO getKingKongConfigInfo(@RequestParam("id") Long id,@StageLoginEmp StageEmpDTO empDTO) {
        return kingKongConfigService.getKingKongConfigInfo(id);
    }
}
